// The URL on your server where CesiumJS's static files are hosted.
window.CESIUM_BASE_URL = '/Cesium';

import { Cartesian3, createOsmBuildingsAsync, Ion, Math as CesiumMath, Terrain, Viewer } from 'cesium';
import "cesium/Build/Cesium/Widgets/widgets.css";



// Your access token can be found at: https:/ / ion.cesium.com / tokens.
// This is the default access token from your ion account

Ion.defaultAccessToken = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiI3NWUyOGRlMS1mZGU4LTQxNTEtODJlZi05YTUxYWRjNzQ4N2IiLCJpZCI6MTM2NjEyLCJpYXQiOjE2ODMxNzM0Mjl9.DE22PIX_6KTqhwESwBZG_ExKqvFLLbUflizxmS8LzeQ';

// Initialize the Cesium Viewer in the HTML element with the `cesiumContainer` ID.
const viewer = new Viewer('app', {
    terrain: Terrain.fromWorldTerrain(),
    infoBox: false
});

// Fly the camera to San Francisco at the given longitude, latitude, and height.
viewer.camera.flyTo({
    destination: Cartesian3.fromDegrees(-122.4175, 37.655, 400),
    orientation: {
        heading: CesiumMath.toRadians(0.0),
        pitch: CesiumMath.toRadians(-15.0),
    }
});

// Add Cesium OSM Buildings, a global 3D buildings layer.
const buildingTileset = await createOsmBuildingsAsync();
viewer.scene.primitives.add(buildingTileset);
